import { request } from '@/framework/utils/request-jdz';

/**
 * 冰箱绑定操作
 */
// 解除平板和冰箱的绑定
export const tabletUnbindTabletIcebox = (params) => {
  return request(
    {
      url: '/tablet/unbind/tablet2icebox',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 绑定平板和冰箱。允许一个冰箱绑定多个平板，每个平板的信息显示都一样。但不允许一个平板绑定给多个冰箱。
export const tabletBindTabletIcebox = (params) => {
  return request(
    {
      url: '/tablet/bind/tablet2icebox',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

/**
 * 客户端升级
 */
export const upgradeQuery = (params) => {
  return request(
    {
      url: '/upgrade',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const upgradeAdd = (params) => {
  return request(
    {
      url: '/upgrade',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const upgradeDelete = (id) => {
  return request(
    {
      url: `/upgrade/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const upgradeUpdate = (params) => {
  return request(
    {
      url: `/upgrade/${params.id}`,
      method: 'put',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
